package collection;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionDemo {
    public static void main(String[] args) {
        Collection c=new ArrayList();
        c.add(new PointCol(1,2));
        c.add(new PointCol(3,4));
        c.add(new PointCol(5,6));
        c.add(new PointCol(7,8));
        c.add(new PointCol(9,0));
        c.add(new PointCol(1,2));
        //System.out.println(c);

        Collection cc=new ArrayList();
        PointCol pp=new PointCol(1,2);
        cc.add(pp);//将pp添加到cc中  将pp的引用添加到了cc 中
        System.out.println("pp:"+pp);//1，2
        System.out.println("cc:"+cc);//1,2
        pp.setX(100);
        System.out.println("pp:"+pp);
        System.out.println("cc:"+cc);



















      /*  Collection c=new ArrayList();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        System.out.println(c);

        System.out.println("size:"+c.size());//5个
        //isEmpty()判断是否为空集(size()为0表示为空集)
        System.out.println("是否为空集"+c.isEmpty());//false

        c.clear();//清空合集

        System.out.println("集合已清空");
        System.out.println(c);
        System.out.println("size:"+c.size());//0
        System.out.println("是否为空集"+c.isEmpty());//true

       */
    }
}
